home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / init.d / virtualbox-guest-utils < prev    next >
Encoding:
Text File  |  2012-03-26  |  1.3 KB  |  74 lines

  1. #!/bin/sh
  2. # (C) 2007 Michael Meskes <meskes@debian.org>
  3.  
  4. ### BEGIN INIT INFO
  5. # Provides:          vboxguest virtualbox-guest-utils
  6. # Short-Description: VirtualBox Linux Additions
  7. # Required-Start:    $remote_fs
  8. # Required-Stop:     $remote_fs
  9. # Default-Start:     2 3 4 5
  10. # Default-Stop:      0 1 6
  11. ### END INIT INFO
  12.  
  13. PATH=$PATH:/bin:/sbin:/usr/sbin
  14.  
  15. . /lib/lsb/init-functions
  16.  
  17. test -d /usr/share/doc/virtualbox-guest-utils -a -x /usr/sbin/VBoxService || exit 0
  18.  
  19. in_virtual_machine()
  20. {
  21.     if [ -z "$(lspci -d 80ee:beef)" ]; then
  22.         log_warning_msg "VirtualBox Additions disabled, not in a Virtual Machine"
  23.         return 1
  24.     fi
  25.  
  26.     return 0
  27. }
  28.  
  29. case "$1" in
  30.   start)
  31.     in_virtual_machine || exit 0
  32.     log_begin_msg "Starting VirtualBox Additions"
  33.  
  34.     start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/VBoxService
  35.     if [ $? -ne 0 ]; then
  36.         log_end_msg 1
  37.         exit 1
  38.     fi
  39.  
  40.     log_end_msg 0
  41.     ;;
  42.  
  43.   stop)
  44.     in_virtual_machine || exit 0
  45.     log_begin_msg "Stopping VirtualBox Additions"
  46.  
  47.     start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/VBoxService
  48.     if [ $? -ne 0 ]; then
  49.         log_end_msg 1
  50.         exit 1
  51.     fi
  52.  
  53.     log_end_msg 0
  54.     ;;
  55.  
  56.   restart|force-reload)
  57.     $0 stop && $0 start
  58.     ;;
  59.  
  60.   status)
  61.     if ! pgrep -x VBoxService > /dev/null; then
  62.         echo "VBoxService daemon isn't running"
  63.         exit 3
  64.     fi
  65.  
  66.     exit 0
  67.     ;;
  68.  
  69.   *)
  70.     echo "Usage: $0 {start|stop|restart|force-reload|status}"
  71.     exit 1
  72.     ;;
  73. esac
  74.